package com.aspose.slides.examples.asposefeatures.charts.numberformatforchartdatacell; import com.aspose.slides.ChartType; import com.aspose.slides.IChart; import com.aspose.slides.IChartDataPoint; import com.aspose.slides.IChartSeries; import com.aspose.slides.IChartSeriesCollection; import com.aspose.slides.ISlide; import com.aspose.slides.Presentation; import com.aspose.slides.SaveFormat; import com.aspose.slides.examples.Utils; public class AsposeNumberFormatForChartDataCell { public static void main(String[] args) { // The path to the documents directory. String dataDir = Utils.getDataDir(AsposeNumberFormatForChartDataCell.class); // Instantiate the presentation//Instantiate the presentation Presentation pres = new Presentation(); // Access the first presentation slide ISlide slide = pres.getSlides().get_Item(0); // Adding a defautlt clustered column chart IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 500, 400); // Accessing the chart series collection IChartSeriesCollection series = chart.getChartData().getSeries(); // Setting the preset number format // Traverse through every chart series for (IChartSeries ser : series) { // Traverse through every data cell in series for (IChartDataPoint cell : ser.getDataPoints()) { // Setting the number format cell.getValue().getAsCell().setPresetNumberFormat((byte) 10); // 0.00% } } // Saving presentation pres.save(dataDir + "AsposePresetNumberFormat.pptx", SaveFormat.Pptx); System.out.println("AsposePresetNumberFormat Saved."); } }